package com.liu.nb.controller;

import cn.hutool.captcha.LineCaptcha;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liu.nb.service.*;
import com.liu.nb.service.impl.SysRoleService;
import com.liu.nb.util.JwtUtils;
import com.liu.nb.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

public class BaseController{
    @Autowired
    ServletRequest request;
    @Autowired
    RedisUtil redisUtil;
    @Autowired
    ISysUserService sysUserService;
    @Autowired
    ISysRoleService sysRoleService;
    @Autowired
    ISysMenuService sysMenuService;
    @Autowired
    ISysUserRoleService sysUserRoleService;
    @Autowired
    ISysRoleMenuService sysRoleMenuService;
    @Autowired
    BCryptPasswordEncoder bCryptPasswordEncoder;
    @Autowired
    JwtUtils jwtUtils;
    /*
    * 获取页码
    * */
    public Page getPage(){
        int current = ServletRequestUtils.getIntParameter(request,"current",1);
        int size=ServletRequestUtils.getIntParameter(request,"size",10);
        return new Page(current,size);
    }

}
